package pl.edu.pb.wi.cookbook.session;

import java.io.Serializable;

import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

import pl.edu.pb.wi.cookbook.entity.User;

@Component
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class UserSession implements Serializable {
    private static final long serialVersionUID = 7205617434955245425L;

    private User user;

    public UserSession() {
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public boolean getIsAdmin() {
        return user == null ? false : user.isAdmin();
    }

    public boolean getIsValidated() {
        return user == null ? false : user.isValidated();
    }

}
